package com.neusoft.hifly.rpc.area.dao;

import com.neusoft.hifly.core.pojo.ApiResponse;
import com.neusoft.hifly.rpc.area.dao.fallback.AreaFallback;
import com.neusoft.hifly.rpc.area.entity.AreaObj;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.util.List;

/**
 * Title: 数据字典服务
 * <p>
 * Description: 区信息 Dao
 * <p>
 * Copyright: 2019
 * <p>
 * Company: 东软汉枫
 *
 * @author lijx
 * @version 1.0.0
 */
@FeignClient(value = "ctcloud-cbb-dictionary", fallbackFactory = AreaFallback.class)
public interface IAreaDao  {

	/**
	 * 根据id查询对象
	 *
	 * @param logicId
	 *            id
	 * @return 对象
	 */
	@RequestMapping(value = "/dictionary/api/v1/area/{logicId}", method = RequestMethod.GET)
	ApiResponse<?> getByLogicId(@PathVariable("logicId") long logicId);

	/**
	 * 查询所有对象
	 *
	 * @return 对象集合
	 */
	@GetMapping(value = "/dictionary/api/v1/area/list")
	<T extends List<AreaObj>> ApiResponse<T>  findAll();

	/**
	 * 通过城市ID查询地区
	 *
	 * @param cityLogicId
	 *            城市ID
	 * @return 对象集合
	 */
	@GetMapping(value = "/dictionary/api/v1/area/city/{cityLogicId}")
	<T extends List<AreaObj>> ApiResponse<T>  findByCityLogicId(@PathVariable("cityLogicId") long cityLogicId);
}
